<?php require_once('Connections/sqlaerosnemanje.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>AeroPHPXML :: Pregled Projektov</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
$selected_projekt = $_GET['iprojekt'];
$tabela_koo = $_GET['tipkoo'];
// if ($selected_projekt == null) {
//   $selected_projekt = 1;
//   $tabela_koo = 1;
//   }

mysql_select_db($database_sqlaerosnemanje, $sqlaerosnemanje);
$query_izberiProjekt = "SELECT * FROM projekti";
$izberiProjekt = mysql_query($query_izberiProjekt, $sqlaerosnemanje) or die(mysql_error());
$row_izberiProjekt = mysql_fetch_assoc($izberiProjekt);
$totalRows_izberiProjekt = mysql_num_rows($izberiProjekt);
?>
<p class="myhead">Seznam to&#269;k </p>
<form action="seznam_tock.php<?php echo "?iprojekta=".$selected_projekt."&tipkoo=".$tabela_koo.""; ?>" method="get" name="izberiForm" class="small-font" id="izberiForm">
Spodaj iz seznama izberi projekt za katerega &#382;eli&scaron; pogledati to&#269;ke.<br />
<table width="200">
  <tr>
    <td><label>
      <input name="tipkoo" type="radio" value="1" checked="checked" />
      WGS'84</label></td>
  </tr>
  <tr>
    <td><label>
      <input type="radio" name="tipkoo" value="2" />
      WGS'84 Rezultati</label></td>
  </tr>
  <tr>
    <td><label>
      <input type="radio" name="tipkoo" value="3" />
      D96/TM</label></td>
  </tr>
  <tr>
    <td><label>
      <input type="radio" name="tipkoo" value="4" />
      D96/TM Rezultati</label></td>
  </tr>
</table>
<br />
  Projekt:
  <select name="iprojekt">
<?php
do {  
?>
    <option value="<?php echo $row_izberiProjekt['IDP']?>"><?php echo $row_izberiProjekt['Naziv']?></option>
<?php
  } 
while ($row_izberiProjekt = mysql_fetch_assoc($izberiProjekt));
  $rows = mysql_num_rows($izberiProjekt);
  if($rows > 0) {
      mysql_data_seek($izberiProjekt, 0);
	  $row_izberiProjekt = mysql_fetch_assoc($izberiProjekt);
  }
?>
  </select>
  <input name="Submit" type="submit" value="Prikaz" />
</form>
<a href="index.php">&lt;&lt;&lt; Nazaj na prvo stran</a> | <a href="prikazi_projekte.php">Pregled projektov</a> <br />
<?php
// branje WG koordinat iz tabele tocke_geodetic
if ($tabela_koo == 1) {
mysql_select_db($database_sqlaerosnemanje, $sqlaerosnemanje);
$query_branje_wg = "SELECT * FROM tocke_geodetic WHERE IDProjekta = '$selected_projekt' ORDER BY UID ASC";
$branje_wg = mysql_query($query_branje_wg, $sqlaerosnemanje) or die(mysql_error());
$num_branje_wg = mysql_num_rows($branje_wg);
?> 
<span class="titletext">WGS'84</span>
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
  <tr>
   <th width="100" align="left" valign="middle">Ime To&#269;ke </th>
   <th width="100" align="left" valign="middle">lat</th>
   <th width="100" align="left" valign="middle">lon</th>
   <th width="70" align="left" valign="middle">elip. vi&scaron;ina </th>
   <th width="50" align="left" valign="middle">&scaron;t. reda </th>
  </tr>
<?php
for($xwg = 0; $xwg < $num_branje_wg; $xwg++)
{
	$row_branje_wg = mysql_fetch_assoc($branje_wg);
echo "<tr><td bgcolor=\"#CCCCCC\">".$row_branje_wg['imeTocke']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['lat']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['lon']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['elipVisina']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['stReda']."</td></tr>";
}
?>
</table>   
<?php
mysql_free_result($branje_wg);
}

// branje WG koordinat rezultatov iz tabele tocke_geodetic_result
if ($tabela_koo == 2) {
mysql_select_db($database_sqlaerosnemanje, $sqlaerosnemanje);
$query_branje_wg = "SELECT * FROM tocke_geodetic_result WHERE IDProjekta = '$selected_projekt' ORDER BY Cas ASC";
$branje_wg = mysql_query($query_branje_wg, $sqlaerosnemanje) or die(mysql_error());
$num_branje_wg = mysql_num_rows($branje_wg);
?> 
<span class="titletext">WGS'84 (Rezultati) </span>
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
  <tr>
   <th width="100" align="left" valign="middle">Ime To&#269;ke </th>
   <th width="100" align="left" valign="middle">lat</th>
   <th width="100" align="left" valign="middle">lon</th>
   <th width="70" align="left" valign="middle">elip. vi&scaron;ina </th>
   <th width="50" align="left" valign="middle">&scaron;t. reda </th>
   <th width="70" align="left" valign="middle">Datum</th>
   <th width="70" align="left" valign="middle">&#268;as</th>
  </tr>
<?php
for($xwg = 0; $xwg < $num_branje_wg; $xwg++)
{
	$row_branje_wg = mysql_fetch_assoc($branje_wg);
echo "<tr><td bgcolor=\"#CCCCCC\">".$row_branje_wg['imeTocke']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['lat']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['lon']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['elipVisina']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['stReda']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Datum']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Cas']."</td></tr>";
}
?>
</table>   
<?php
mysql_free_result($branje_wg);
}
// branje WG koordinat rezultatov iz tabele tocke_geodetic_result
if ($tabela_koo == 3) {
mysql_select_db($database_sqlaerosnemanje, $sqlaerosnemanje);
$query_branje_wg = "SELECT * FROM tocke_grid WHERE IDProjekta = '$selected_projekt' ORDER BY id ASC";
$branje_wg = mysql_query($query_branje_wg, $sqlaerosnemanje) or die(mysql_error());
$num_branje_wg = mysql_num_rows($branje_wg);
?> 
<span class="titletext">D96/TM </span>
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
  <tr>
   <th width="100" align="left" valign="middle">Ime To&#269;ke </th>
   <th width="100" align="left" valign="middle">E</th>
   <th width="100" align="left" valign="middle">N</th>
   <th width="70" align="left" valign="middle">orto. vi&scaron;ina</th>
   <th width="50" align="left" valign="middle">&scaron;t. reda</th>
  </tr>
<?php
for($xwg = 0; $xwg < $num_branje_wg; $xwg++)
{
	$row_branje_wg = mysql_fetch_assoc($branje_wg);
echo "<tr><td bgcolor=\"#CCCCCC\">".$row_branje_wg['imeTocke']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Y']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['X']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['ortoVisina']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['stReda']."</td></tr>";
}
?>
</table>   
<?php
mysql_free_result($branje_wg);
}
// branje WG koordinat rezultatov iz tabele tocke_geodetic_result
if ($tabela_koo == 4) {
mysql_select_db($database_sqlaerosnemanje, $sqlaerosnemanje);
$query_branje_wg = "SELECT * FROM tocke_grid_result WHERE IDProjekta = '$selected_projekt' ORDER BY Time ASC";
$branje_wg = mysql_query($query_branje_wg, $sqlaerosnemanje) or die(mysql_error());
$num_branje_wg = mysql_num_rows($branje_wg);
?> 
<span class="titletext">D96/TM (Rezultati) </span>
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
  <tr>
   <th width="100" align="left" valign="middle">Ime To&#269;ke </th>
   <th width="100" align="left" valign="middle">lat</th>
   <th width="100" align="left" valign="middle">lon</th>
   <th width="70" align="left" valign="middle">orto. vi&scaron;ina </th>
   <th width="50" align="left" valign="middle">&scaron;t. reda </th>
   <th width="70" align="left" valign="middle">Datum</th>
   <th width="70" align="left" valign="middle">&#268;as</th>
  </tr>
<?php
for($xwg = 0; $xwg < $num_branje_wg; $xwg++)
{
	$row_branje_wg = mysql_fetch_assoc($branje_wg);
echo "<tr><td bgcolor=\"#CCCCCC\">".$row_branje_wg['IDP']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Easting']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Northing']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Height']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['stReda']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Date']."</td><td bgcolor=\"#CCCCCC\">".$row_branje_wg['Time']."</td></tr>";
}
?>
</table>   
<?php
mysql_free_result($branje_wg);
}
mysql_free_result($izberiProjekt);

mysql_close();
?>
<br>
<a href="index.php">&lt;&lt;&lt; Nazaj na prvo stran</a> | <a href="prikazi_projekte.php">Pregled projektov</a><br>
</body>
</html>